﻿using Bll;
using IBll;
using MD5Hash;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MemberController : ControllerBase, IMemberBll
    {
        public MemberController(IMemberBll bll)
        {
            Bll = bll;
        }

        public IMemberBll Bll { get; }

        [HttpPost]
        public async Task<int> AddMember(Member member)
        {
            return await Bll.AddMember(member);
        }
        [HttpGet]
        public List<MemberLevle> GetMemberLevle()
        {
            return Bll.GetMemberLevle();
        }
        [HttpGet]
        public dynamic GetMember()
        {
            return Bll.GetMember();
        }
        [HttpDelete]
        public async Task<int> IsDelMember(int id)
        {
            return await Bll.IsDelMember(id);
        }
        [HttpGet]
        public Member GetUpdaMember(int id)
        {
            return Bll.GetUpdaMember(id);
        }
        [HttpPut]
        public async Task<int> UpdaMember(Member member)
        {
            return await Bll.UpdaMember(member);
        }
    }
}
